@echo off
:startPoint
echo.
echo =========================================================
echo       Windows services install          
echo =========================================================
echo.



@REM ----------------------------
@REM     input the system name
@REM ----------------------------

:ISystemName


set bindir=%~dp0

echo 1. please input the system name:
set /p systemName=
if /i "%systemName%" == "" (echo you not input any words. && goto  ISystemName)

echo %systemName% >%bindir%ServiceSetup.ini


@REM ----------------------------------------
@REM     print the summery information
@REM ----------------------------------------

echo.
echo =========================================================
echo.  
echo      Windows service information
echo.   
echo      System Name:%systemName%   
echo.
echo =========================================================
echo.

echo Please confirm the input message.
echo.
echo =========================================================
echo.    
echo      Y: Confirm the information and install the service
echo      N: Reset the install information.
echo      E: Exit.
echo.     
echo =========================================================
echo.

set /p confirmMSG=
if /i "%confirmMSG%"=="y" (%WINDIR%\Microsoft.NET\Framework\v4.0.30319\installutil -systemName="%systemName%"  "%bindir%WinServicesSample.exe" && pause)
if /i "%confirmMSG%"=="n" (goto startPoint)
if /i "%confirmMSG%"=="e" (echo on && exit)

:end